//
//  TableViewDelegate.m
//  SUZHOUBANK
//
//  Created by apple on 16/4/13.
//  Copyright © 2016年 RuiFeng-WGCC. All rights reserved.
//

#import "TableViewDelegate.h"
#import "SelectphotoViewController.h"
@interface TableViewDelegate ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
{

UIImagePickerController  *_imagePickerController;/**< 图片拾取器 */
}

@property (nonatomic, copy) TableViewDidSelectRowAtIndexPath tableViewDidSelectRowAtIndexPath;

@end

@implementation TableViewDelegate
- (instancetype) init {
    
    self = [super init];
    
    if (self) {
        [self initialzeDataSouce];
    }
    return self;
}
- (void)initialzeDataSouce{
    _imagePickerController = [[UIImagePickerController alloc]init];
    _imagePickerController.delegate = self;

}

- (instancetype) initWithDidSelectRowAtIndexPath:(TableViewDidSelectRowAtIndexPath)tableViewDidSelectRowAtIndexPath {
    
    self = [super init];
    
    if (self) {
        self.tableViewDidSelectRowAtIndexPath = [tableViewDidSelectRowAtIndexPath copy];
    }
    return self;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 40;
}

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (self.tableViewDidSelectRowAtIndexPath) {
        self.tableViewDidSelectRowAtIndexPath(indexPath.row);
    }

}





@end
